<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Bootstrap Multi Step Registration Form Template</title>

        <!-- CSS -->
        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
        <link rel="stylesheet" href="../static/css/register/bootstrap.min.css">
        <link rel="stylesheet" href="../static/css/register/font-awesome.min.css">
		<link rel="stylesheet" href="../static/css/register/form-elements.css">
        <link rel="stylesheet" href="../static/css/register/style.css">


        <!-- Favicon and touch icons -->
        <link rel="shortcut icon" href="../img/favicon.png">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../img/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../img/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../img/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="../img/apple-touch-icon-57-precomposed.png">
        <link rel="shortcut icon" href="../img/favico.ico" type="image/x-icon">

    </head>

    <body>
    
<div style="background: url(../img/backgrounds/1.jpg); background-size: cover;">
		<!-- Top menu -->
		<nav class="navbar navbar-inverse navbar-no-bg" role="navigation">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#top-navbar-1">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="register1.jsp">Bootstrap Multi Step Registration Form Template</a>
				</div>
				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse" id="top-navbar-1">

				</div>
			</div>
		</nav>

        <!-- Top content -->
        <div class="top-content">
        	
            <div class="inner-bg">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-8 col-sm-offset-2 text">
                            <h1><strong>日程安排</strong>   开始注册你的个性账号</h1>
                            <div class="description">
                            	<p>
	                            	为了向您提供更优质服务，请认真填写相关信息<br>
									我们承诺保护您的个人隐私。我们将仅以合法方式收集和使用您的信息。
                            	</p>
                            </div>
                        </div>
                    </div>
                    <div class="row">


                        <div class="col-sm-6 col-sm-offset-3 form-box">
                        	
                        	<dic class="registration-form">
                        		
                        		<fieldset>
		                        	<div class="form-top">
		                        		<div class="form-top-left">
		                        			<h3>Step 1 / 2</h3>
		                            		<p>设置你的账户密码 :</p>
		                        		</div>
		                        		<div class="form-top-right">
		                        			<i class="fa fa-user"></i>
		                        		</div>
		                            </div>
		                            <div class="form-bottom">
				                    	<div class="form-group">
				                    		<!--<label class="sr-only" for="form-first-name">First name</label>-->
				                        	<input type="text" name="user" id="user" placeholder="用户名" class="form-first-name form-control" id="form-first-name">
				                        </div>
				                        <div class="form-group">
				                        	<!--<label class="sr-only" for="form-last-name">Last name</label>-->
				                        	<input type="password" name="password" id="password" placeholder="密码" class="form-last-name form-control" id="form-last-name">
				                        </div>
				                        <div class="form-group">
				                        	<!--<label class="sr-only" for="form-about-yourself">About yourself</label>-->
											<input type="password" name="psw1" id="psw1" placeholder="确认密码" class="form-last-name form-control" id="form-about-yourself">

				                        	<!--<input name="form-about-yourself" placeholder=""-->
				                        				<!--class="form-last-name form-control" id="form-about-yourself">-->
				                        </div>
				                        <button type="button" class="btn btn-next">下一步</button>
				                    </div>
			                    </fieldset>
			                    
			                    <fieldset style="display: none">
		                        	<div class="form-top">
		                        		<div class="form-top-left">
		                        			<h3>Step 2 / 2</h3>
		                            		<p>设置你的个人信息:</p>
		                        		</div>
		                        		<div class="form-top-right">
		                        			<i class="fa fa-key"></i>
		                        		</div>
		                            </div>
									 
		                            <div class="form-bottom">
				                        <div class="form-group">
				                        	<!--<label class="sr-only" for="form-email">Email</label>-->
				                        	<input type="text" name="name" id="name"  placeholder="姓名" class="form-email form-control" id="form-email">
				                        </div>
				                        <div class="form-group">
				                    		<!--<label class="sr-only" for="form-facebook">Facebook</label>-->
				                        	<input type="text" name="phone" id="phone" placeholder="手机号" class="form-facebook form-control" id="form-facebook">
				                        </div>
				                        <div class="form-group">
				                        	<!--<label class="sr-only" for="form-twitter">Twitter</label>-->
				                        	<input type="text" name="address" id="address" placeholder="邮箱" class="form-twitter form-control" id="form-twitter">
				                        </div>
				                         <button type="button" class="btn btn-previous">前一步</button>
				                        <button id="register" class="btn" onclick="tiao()">完成注册</button>
				                    </div>
									
			                    </fieldset>
			                    
			                   
		                    
		                    </div>
		                    
                        </div>



                    </div>
                </div>
            </div>
            
        </div>
<script>
function tiao(){
	location.href="login.jsp";
}
</script>

        <!-- Javascript -->
        <script src="../static/js/register/jquery-1.11.1.min.js"></script>
        <script src="../static/js/register/bootstrap.min.js"></script>
        <script src="../static/js/register/jquery.backstretch.min.js"></script>
        <script src="../static/js/register/retina-1.1.0.min.js"></script>
        <script src="../static/js/register/scripts.js"></script>
        
  <script type="text/javascript">
      $(document).ready(function(){
    	  var flag=1;
    	  $("#user").blur(function(){
    		  var user=$("#user").val();
    		  
    		  $.ajax({
					type:"GET",
					url:"/Schedule/findUser.action",
					contentType:"application/json;charset=utf-8",
					data:{'user':user},
					dataType:"json",   
					async:false,//同步请求 必填 默认为true，代表异步请求。若为同步请求将锁住浏览器，用户其他操作必须等待请求完成才可以执行
					success:function(result){
						if(result.code==-1){
							alert(result.data);
							flag=0;
						}else{
							flag=1;
						}
					}
				});//ajax
			
    	  });//user
    	  
    	  $("#psw1").blur(function(){
    		  var password=$("#password").val();
    		  var psw1=$("#psw1").val();
    		  if(password!=psw1){
    			  flag=0;
    			  alert("两次密码不一致");
    		  }else{
					flag=1;
				}
    		 
    	  });//psw1
    	  
    	  $("#phone").blur(function(){
    		  var phone=$("#phone").val();
    		  $.ajax({
					type:"GET",
					url:"/Schedule/findPhone.action",
					contentType:"application/json;charset=utf-8",//默认值“application/x-www-form-urlencoded”发送信息至服务器时内容编码类型
					data:{'phone':phone},
					dataType:"json", 
					async:false,//同步请求 必填 默认为true，代表异步请求。若为同步请求将锁住浏览器，用户其他操作必须等待请求完成才可以执行
					success:function(result){
						if(result.code==-1){
							alert(result.data);
							flag=0;
						}else{
							flag=1;
						}
						
					}
				});//ajax
    	  });//phone
    	  
    	
    	  
    	  $("#register").click(function(){
    		  if(flag==1){
    			  var user=$("#user").val();
          		  var psw1=$("#password").val();
          		  var name=$("#name").val();
          	      var phone=$("#phone").val();
          	      var address=$("#address").val();
          	      var remember=0;
    	      	  var param_data={         				        				
    					'user':user,
    					'password':psw1,
    	  				'name':name,
    	  				'phone':phone,
    	  				'address':address,
    	  				'remember':remember
    			  }
        		  $.ajax({
    					type:"GET",
    					url:"/Schedule/addUser.action",
    					contentType:"application/json;charset=utf-8",
    					data:{'param':JSON.stringify(param_data)},
    					dataType:"json",
    					async:false,
    					success:function(result){
    					
    							alert(result.data);
    						
    						
    					}
    				});//ajax
    		  }//if(flag==1)
    		  else{
    			  alert("注册失败");
    		  }
    	  });//register
    	  
      });
        
  </script>


    </body>
</html>